<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('品牌')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Token')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-token" class="form-control" style="width: 90%;" name="row[token]" disabled type="text" value="{$row.token|htmlentities}">
            <a href="javascript:;" onclick="getAjax()" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i></a>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('需要跳转的url地址')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-url" class="form-control" name="row[url]" type="text" value="{$row.url|htmlentities}">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('需要处理的url地址列表(用;分割)')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-urls" class="form-control " rows="5" name="row[urls]" cols="50">{$row.urls|htmlentities}</textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            
            <div class="radio">
            {foreach name="statusList" item="vo"}
            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>

        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>


<script>
    function getAjax() {
        var value = document.getElementById('c-name').value;
        var xhr = new XMLHttpRequest();
        xhr.open("POST", "{:Url('manufacturer/createToken')}", true);

        xhr.onreadystatechange = function() {
            if(xhr.readyState == 4 && xhr.status == 200){
                document.getElementById('c-token').value = JSON.parse(xhr.responseText).data
            }
        }
        xhr.setRequestHeader('Content-Type',' application/x-www-form-urlencoded');

        xhr.send("name="+value)
    }
</script>